/**
 * Created by no1 on 2015/11/2.
 */
'use strict';
/**
 * Module sellRole.
 */
let mongoose = require('mongoose');
var sellRole = new mongoose.Schema({
  //角色id
  rid: {
    type: Number,
    required: true,
    unique: true,
    index: true
  },
  //名称
  name: String,
  //商家id
  vid: {
    type: Number,
    index: true
  },
  //able 0 没有,1有
  permissionTree: [{
    code: Number,
    able: Number,
    nextPer: [{
      code: Number,
      able: Number
    }]
  }],
  //权限
  permissionCodes: {
    type: [Number]
  },
  //创建时间
  createdAt: {
    type: Date,
    "default": Date.now
  },
  //最后更新时间
  updateAt: {
    type: Date,
    "default": Date.now
  },
  //是否保留 , 1 是 则不可以删除 . 0 不是  则可以删除
  retain: {
    type: Number,
    "default": 0
  },
  //状态 0删除 1可用
  status: {
    type: Number,
    index: true
  }
});
module.exports = mongoose.model('sellRole', sellRole);